package chp06.homework;

public class Home5 {

    public static void main(String[] args) {
        //输入一个数字 比如:5
        //输出 1+2+3+4+5=15
        int num = 5;
        int sum = 0;
        //continue
        for (int i = 1; i <= num; i++){
//            if(i == num){
//                System.out.print(i);
//            }else{
//                System.out.print(i+"+");
//            }

            if(i != num){
                System.out.print(i+"+");
            }else{
                System.out.print(i);
            }
            sum += i;
        }
        System.out.println("="+sum);
    }
}
